
#ifndef __8051_H__
#define __8051_H__

#include "stdtype.h"

#define		CPU_CLOCK			6000000L						//6 MHz
#define   TIMER_UNIT    10                  //10uS
#define		TIMER_FACTOR	((CPU_CLOCK/1000000)*TIMER_UNIT)/12
#define		T350US				0-(35*TIMER_FACTOR)
#define		T100US				0-(10*TIMER_FACTOR)
#define		T800US 				0-(80*TIMER_FACTOR)
#define		T1MS 					0-(100*TIMER_FACTOR)
#define		T10MS					0-(1000*TIMER_FACTOR)

void InitCPU(void);
void EnableINT0(void);
void EnableINT1(void);
void EnableTimer0(U16 time);
void DisableTimer0(void);
void EnableTimer1(U16 time);
void EnableTimer1Int(void);
//void DisableTimer1(void);
void EnableUART(void);
void Delay(U16 time);
void ResetTimer(void);
U16 GetTimeEscape(void);
extern void ResetUsbTmr(void);
extern U16 gUsbInitTmr;
extern U16 gRfIdleTmr;
#endif